const { DataTypes } = require('sequelize')
const sequelize = require('./db')
const User = sequelize.define(
  'user',
  {
    // 理解为表中的列
    // 会自动添加一个叫做Id的主键
    userName: {
      type: DataTypes.STRING(100),
      allowNull: false,
    },
    loginPwd: {
      type: DataTypes.STRING(100),
      allowNull: false,
    },
    userType: {
      type: DataTypes.STRING(100),
      allowNull: false,
    },
    permission: {
      type: DataTypes.INTEGER,
      allowNull: false,
    },
    loginStatus: {
      type: DataTypes.BOOLEAN,
      allowNull: false,
      defaultValue: false, //默认登录状态为false
    },
  },
  {
    paranoid: true, // 默认是false
  }
)
module.exports = User
